Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the yaql/jinja vars extraction to ignore methods of base ctx() dict #196

Merged
merged 10 commits into from
Apr 10, 2020

Conversation

m4dcoder
Copy link
Collaborator

The ctx() method returns a dict and there are use cases where users call supported methods on the dict such as keys(), values(), and get(). The vars extraction would return false positives on these function calls. The regular expressions to extract variables from expressions is refactored to ignore these dict related function calls directly on ctx(). Fixes StackStorm/st2#4866.

The ctx() method returns a dict and there are use cases where users call supported methods on the dict such as keys(), values(), and get().  The vars extraction would return false positives on these function calls. The regular expressions to extract variables from expressions is refactored to ignore these dict related function calls directly on ctx().
@m4dcoder m4dcoder requested a review from blag April 10, 2020 00:09
Copy link
Contributor

@blag blag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review still in progress.

orquesta/expressions/jinja.py Outdated Show resolved Hide resolved
orquesta/expressions/jinja.py Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Apr 10, 2020

Codecov Report

Merging #196 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #196      +/-   ##
==========================================
- Coverage   94.04%   94.03%   -0.02%     
==========================================
  Files          41       41              
  Lines        2739     2733       -6     
  Branches      542      544       +2     
==========================================
- Hits         2576     2570       -6     
  Misses        100      100              
  Partials       63       63              
Impacted Files Coverage Δ
orquesta/expressions/base.py 100.00% <ø> (ø)
orquesta/expressions/jinja.py 92.42% <100.00%> (-0.17%) ⬇️
orquesta/expressions/yql.py 89.69% <100.00%> (-0.31%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 419a4a9...c5ef955. Read the comment docs.

blag and others added 4 commits April 10, 2020 11:00
…lify-regexes

Simplify Jinja expression context regexes
Copy the simpliciation for Jinja evaluator to the YAQL evaluator. Add more test cases to ensure correctness.
@m4dcoder m4dcoder merged commit dc85df7 into master Apr 10, 2020
@m4dcoder m4dcoder deleted the fix-variables-evaluation branch April 10, 2020 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Orquesta workflow ctx().get() throws a YAQL error
3 participants